gettext_{$domain}
Filter HookDescription
Filters text with its translation for a domain. The dynamic portion of the hook name, `$domain`, refers to the text domain.Hook Information
File Location |
wp-includes/l10n.php
View on GitHub
|
Hook Type | Filter |
Line Number | 220 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$translation
|
Translated text. |
string
|
$text
|
Text to translate. |
string
|
$domain
|
Text domain. Unique identifier for retrieving translated strings. |
Usage Examples
Basic Usage
<?php
// Hook into gettext_{$domain}
add_filter('gettext_{$domain}', 'my_custom_filter', 10, 3);
function my_custom_filter($translation, $text, $domain) {
// Your custom filtering logic here
return $translation;
}
Source Code Context
wp-includes/l10n.php:220
- How this hook is used in WordPress core
<?php
215 *
216 * @param string $translation Translated text.
217 * @param string $text Text to translate.
218 * @param string $domain Text domain. Unique identifier for retrieving translated strings.
219 */
220 $translation = apply_filters( "gettext_{$domain}", $translation, $text, $domain );
221
222 return $translation;
223 }
224
225 /**
PHP Documentation
<?php
/**
* Filters text with its translation for a domain.
*
* The dynamic portion of the hook name, `$domain`, refers to the text domain.
*
* @since 5.5.0
*
* @param string $translation Translated text.
* @param string $text Text to translate.
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/l10n.php
Related Hooks
Related hooks will be displayed here in future updates.